package com.eke.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.eke.bean.Goods;
import com.eke.bean.QuestionFrom;
import com.jason.dbhelper2.jdbc.BaseJdbcTemplate;

@Repository("questionFromDao")
public class QuestionFromDao extends BaseJdbcTemplate<QuestionFrom>{
	/**
	 * 查询拼接问题
	 * @param articleId 文章id
	 * @param startRow  起始页
	 * @param pageSize	每页总数
	 * @return {@link List}<{@link QuestionFrom}>
	 */
	public List<QuestionFrom> qurryPagingQuestion(int startRow, int pageSize){
		String sql = "select t1.user_name,t1.user_photo,t2.interal,t2.article_id,t2.article_title,t2.release_time,t2.comment_number,t2.article_image,t2.read_number,t2.question_state,t3.type_value from users as t1 LEFT JOIN article   as t2  ON  t1.user_id = t2.user_id   LEFT JOIN article_type as t3 ON t3.article_type_id = t2.article_type_id where t2.article_type = 2 ORDER BY release_time DESC limit ?,?"; 
	    return this.queryForList(sql,startRow,pageSize);
	}
	
	/**
	 * 查询拼接文章
	 * @param articleId 文章id
	 * @param startRow  起始页
	 * @param pageSize	每页总数
	 * @return {@link List}<{@link QuestionFrom}>
	 */
	public List<QuestionFrom> qurryPagingArticle(int startRow, int pageSize){
		String sql = "select t1.user_name,t1.user_photo,t2.article_id,t2.article_title,t2.release_time,t2.comment_number,t2.article_image,t2.read_number,t2.article_state,t2.article_content,t3.type_value from users as t1 LEFT JOIN article   as t2  ON  t1.user_id = t2.user_id   LEFT JOIN article_type as t3 ON t3.article_type_id = t2.article_type_id where t2.article_type = 1 ORDER BY release_time DESC limit ?,? "; 
	    return this.queryForList(sql,startRow,pageSize);
	}
}
